package com.futuremap.ws;


import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import com.futuremap.ws.server.WebSocketServer;

@SpringBootApplication
public class MetadataApplication implements CommandLineRunner{
	
	private static final Logger log = LoggerFactory.getLogger(MetadataApplication.class);
	
	@Value("${websocket.port:9876}")
	private Integer wsPort;
	
	@Resource
	private WebSocketServer webSocketServer;

	public static void main(String[] args) {
		SpringApplication.run(MetadataApplication.class, args);
	}
	
	@Override
	public void run(String... args) throws Exception {
		
        log.info("websocket开始启动：");
		webSocketServer.run(wsPort);
		log.info("websocket启动完成,port={}",wsPort);
	}
}
